<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //封装
    class Stu{
       constructor(name){
           this.name=name
       }
       say(){
           console.log("说谎");
       }

    }


    //let o1 = new Stu("gao")
    //    console.log(o1)
    //    o1.say();

    //继承
    class Man extends Stu{
           //多态：注意：写 constructor 第一行 必须写 super()
        constructor(name){
           super(name); //指向父类的 constructor
           this.sex="男"    
        }
         
    }

    let o2 = new Man("王")
    console.log(o2)
       o2.say()


</script>
</html>